package cn.marinda.totipotentwar.global;

import org.bukkit.configuration.ConfigurationSection;

import java.util.HashMap;
import java.util.Map;

public class ShopData extends AbstractPluginConfig{
    private int size;
    private Map<Integer,Slot> slotMap = new HashMap<>();
    /**
     * 摘要插件配置
     *
     *
     */
    public ShopData() {
        super("shop");
        defaultData();
    }

    @Override
    protected void defaultData() {
        this.size = config.getInt("setting.shop.size");
        ConfigurationSection slotSection = config.getConfigurationSection("setting.shop.slot");
        for(String key : slotSection.getKeys(false)){
            int parseKey = Integer.parseInt(key);
            Slot slot = new Slot(config.getString("setting.shop.slot." + parseKey + ".material"),config.getString("setting.shop.slot." + parseKey + ".displayName"),config.getStringList("setting.shop.slot." + parseKey +".lore"),config.getDouble("setting.shop.slot." + parseKey + ".consume"),config.getStringList("setting.shop.slot." + parseKey + ".command"));
            slotMap.put(parseKey,slot);
        }
    }



    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public Map<Integer, Slot> getSlotMap() {
        return slotMap;
    }

    public void setSlotMap(Map<Integer, Slot> slotMap) {
        this.slotMap = slotMap;
    }
}
